<%@ tag body-content="empty"%>
<%@tag description="put the tag description here" pageEncoding="windows-1258"%>
<%@attribute name="searchAction"%>
<%@tag import="javax.portlet.*"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="portlet2_0"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib  uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<portlet:defineObjects />
<portlet2_0:actionURL var="searchActionURL">
    <portlet2_0:param name="action" value="${searchAction}"/>
</portlet2_0:actionURL>
11111111${searchAction}222222222222
<div style="clear: both;display: block; float: none">
    <form:form action="${searchActionURL}" commandName="command">
        <div style="clear: both">
            <div style="float:left"><form:label path="keywords" >Keywords:</form:label></div>
            <div style="float:left"><form:input path="keywords" /></div>
            <div><input type="submit" /></div>
        </div>
    </form:form>
</div>
<div><span>Result:</span></div>
<c:if test="${command.total gt 0}">
    <div style="clear: both;display: block; float: none">
        <form:form action="${searchActionURL}" commandName="command">
            <form:hidden path="keywords"/>
            <form:hidden path="start"/>
            <div style="float:left">
                Total: ${command.total}<form:hidden path="total"/>
            </div>
            <div style="float:left">
                <form:label path="maxPerPage">Max per page: </form:label>
                <form:select path="maxPerPage" onchange="alert('changes')">
                    <form:option label="10" value="10"/>
                    <form:option label="20" value="20"/>
                    <form:option label="30" value="30"/>
                    <form:option label="40" value="40"/>
                    <form:option label="50" value="50"/>
                </form:select>
            </div>
            <div style="float:left">
                <input type="button" name="nav" value="back">Back</input>
            </div>
            <div style="float:left">
                <form:label path="currentPage">page: </form:label>
                <form:select path="currentPage">
                    <form:options items="${command.pages}" itemLabel="pageIndexLabel" itemValue="pageIndex"/>
                </form:select>
            </div>
            <div >
                <input type="button" name="nav" value="next">Next</input>
            </div>
        </form:form>
    </div>
</c:if>
<div>
    <table>
        <thead>
            <tr>
                <c:forEach items="${command.columns}" var="column">
                    <th>${column.columnName}</th>
                </c:forEach>
            </tr>
        </thead>
        <c:if test="${command.total gt 0}">
            <tbody>
                <c:forEach items="${command.result}" var="row">
                    <tr>
                        <c:forEach items="${command.columns}" var="column">
                            <td>${row[column.fieldName]}</td>
                        </c:forEach>
                    </tr>
                </c:forEach>
            </tbody>
        </c:if>
    </table>
</div>
